﻿using System;
using System.Windows.Forms;
using PhotonModel;

namespace TestApp
{
	public partial class Form1 : Form
	{
		private Photon photon;
		public Form1()
		{
			InitializeComponent();

			textBox1.Text = 0.052.ToString();
			RecreatePhoton();
		}

		private void CheckKeys(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == (char)13)
			{
				RecreatePhoton();
			}
		}

		private void RecreatePhoton()
		{
			try
			{
				photon = new Photon(double.Parse(textBox1.Text));
				lblW.Text = photon.Parameters.w.ToString();
				lblA.Text = photon.Parameters.A.ToString();
				lblE.Text = photon.Parameters.E.ToString();
				lblM.Text = photon.Parameters.m.ToString();
				lblR.Text = photon.Parameters.r.ToString();
				lblT.Text = photon.Parameters.T.ToString();
				lblV.Text = photon.Parameters.v.ToString();
				lblC.Text = photon.Parameters.LinearMotionSpeed.ToString();
			}
			catch (Exception)
			{
				MessageBox.Show(this, "Неверная длина волны", "Ошибка ввода");
			}
		}
	}
}
